import Vue from 'vue' /*引入vue框架*/
import VueRouter from 'vue-router' /*引入路由依赖*/

import PersonInformation from '../views/PersonInformation.vue'

Vue.use(VueRouter) /*使用路由依赖*/

export const asyncRoutes = [{
        path: "/PersonManage",
        name: "PersonManage",
        component: () =>
            import ('@/layout/index.vue'),
        meta: { title: '人员管理', icon: 'el-icon-setting', affix: true },
        children: [{
            path: '/PersonInformation',
            name: 'PersonInformation', //这个是路由的标识，这个名字是唯一识别的key
            component: PersonInformation,
            //这个一般存路由的基础信息，比如图标、名字(title)等等，就是放信息的位置而已，不必纠结
            //title是要显示在页面的值，name是这个路由的标识
            meta: { title: '人员信息', icon: 'el-icon-setting', affix: true },
            //下面我们看带有子菜单的怎么显示出来，用el-submenu 显示子项
        }, ]
    },
    {
        path: "/menu-two",
        name: "menu-two",
        component: () =>
            import ('@/layout/index.vue'),
        meta: { title: '菜单二', icon: 'el-icon-setting', affix: true },
        children: [{
                path: '/menu-two-1',
                name: 'menu-two-1',
                component: () =>
                    import ('@/views/demo2-1.vue'),
                meta: { title: '菜单二-一', icon: 'el-icon-setting', affix: true },
            },
            {
                path: '/menu-two-2',
                name: 'menu-two-2',
                component: () =>
                    import ('@/views/demo2-2.vue'),
                meta: { title: '菜单二-二', icon: 'el-icon-setting', affix: true },
            },
            {
                path: '/menu-two-3',
                name: 'menu-two-3',
                component: () =>
                    import ('@/views/demo2-3.vue'),
                meta: { title: '菜单二-三', icon: 'el-icon-setting', affix: true },
            },
        ]
    },
    {
        path: "/menu-three",
        name: "menu-three",
        component: () =>
            import ('@/layout/index.vue'),
        meta: { title: '菜单三', icon: 'el-icon-setting', affix: true },
        children: [{
            path: '/menu-three-1',
            name: 'menu-three-1',
            component: () =>
                import ('@/views/demo3-1.vue'),
            meta: { title: '菜单三-一', icon: 'el-icon-setting', affix: true },
        }, ]
    },
]

const router = new VueRouter({
    routes: [{
            path: "/",
            name: "Layout",
            component: () =>
                import ('@/layout/index.vue'),
            meta: { title: '框架' },
        },
        ...asyncRoutes
    ],
    // mode: history
})

export default router